import java.util.Scanner;

public class Text1 {
    public static int[] func(int[] arr,int n,int k){
        int[] poker = new int[2*n];
        int sum = 0;
        for (int i=0;i<n;i++){
            poker[sum]=arr[i];
            sum+=2;
        }

        sum = 1;
        for (int i=n;i<2*n;i++){
            poker[sum]=arr[i];
            sum+=2;
        }

        if (k==1) {
            return poker;
        }
        return func(poker,n,k-1);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        int n = 0,k = 0;
        int[] poker;
        int[] ret;
        while(T>0){
            n = sc.nextInt();
            k = sc.nextInt();
            poker = new int[2*n];
            ret = new int[2*n];

            for (int i = 0; i < 2*n; i++) {
                poker[i] = sc.nextInt();
            }
            ret = func(poker,n,k);

            for (int i = 0; i < 2*n; i++) {
                System.out.print(ret[i]+" ");
            }

            System.out.println();
            T--;
        }
    }
}
